﻿using AnChao.WPF.Controls.CheckBoxList.Controls;
using AnChao.WPF.Controls.CheckBoxList.Models;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace AnChao.WPF.Controls.CheckBoxList
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window, INotifyPropertyChanged
    {


        private ObservableCollection<DictType> _Items;
        /// <summary>
        /// 测试
        /// </summary>
        public ObservableCollection<DictType> Items { get { return _Items; } set { if (_Items == value) return; _Items = value; OnPropertyChanged(nameof(Items)); } }


        private DictType _SelectItem;
        /// <summary>
        /// 选中项
        /// </summary>
        public DictType SelectItem { get { return _SelectItem; } set { if (_SelectItem == value) return; _SelectItem = value; OnPropertyChanged(nameof(SelectItem)); } }


        public MainWindow()
        {
            InitializeComponent();
            this.Loaded += MainWindow_Loaded;
        }

        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            Items = new ObservableCollection<DictType>(new List<DictType>()
            {
                new DictType(){ Id="AnChao", Name="安超" },
                new DictType(){ Id="Yanglili", Name="杨丽丽" },
                new DictType(){ Id="SunLing", Name="孙玲" },
                new DictType(){ Id="XuWei", Name="徐微" },
                new DictType(){ Id="SunYu", Name="孙宇" },
                new DictType(){ Id="WangZibing", Name="王子斌" },

            });
        }

        public event PropertyChangedEventHandler PropertyChanged;
        protected void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }




}
